/**
 * Created by henian.xu on 2018/7/20.
 * 过滤器
 */

import moment from 'moment';
import { Comm } from '../utils';

export default {
    install(Vue) {
        Vue.filter('moment', (val, format = 'YYYY-MM-DD') => {
            if (!val) return '';
            return moment(val).format(format);
        });
        Vue.filter('number', (value, length = 2) => {
            return Comm.filterNumber(value, length);
        });

        Vue.filter('price', (value, length = 2, min = true) => {
            return Comm.filterNumber(value, length, min);
        });
    },
};
